import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MenuSectionLinksVO, MenuSectionLinksForm, MenuSectionLinksQuery } from '@/api/shopping/titlemenu/section/links/types';

/**
 * 查询每个内容行里的数据列表
 * @param query
 * @returns {*}
 */

export const listMenuSectionLinks = (query?: MenuSectionLinksQuery): AxiosPromise<MenuSectionLinksVO[]> => {
  return request({
    url: '/shopping/menuSectionLinks/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询每个内容行里的数据详细
 * @param id
 */
export const getMenuSectionLinks = (id: string | number): AxiosPromise<MenuSectionLinksVO> => {
  return request({
    url: '/shopping/menuSectionLinks/' + id,
    method: 'get'
  });
};

/**
 * 新增每个内容行里的数据
 * @param data
 */
export const addMenuSectionLinks = (data: MenuSectionLinksForm) => {
  return request({
    url: '/shopping/menuSectionLinks',
    method: 'post',
    data: data
  });
};

/**
 * 修改每个内容行里的数据
 * @param data
 */
export const updateMenuSectionLinks = (data: MenuSectionLinksForm) => {
  return request({
    url: '/shopping/menuSectionLinks',
    method: 'put',
    data: data
  });
};

/**
 * 删除每个内容行里的数据
 * @param id
 */
export const delMenuSectionLinks = (id: string | number | Array<string | number>) => {
  return request({
    url: '/shopping/menuSectionLinks/' + id,
    method: 'delete'
  });
};
